﻿//-----------------------------------------------------------------------
// <copyright file="LogEntryEntity.cs" company="CodePlex">
//     Copyright (c) Doug Holland, CodePlex. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace CodePlex.Diagnostics.Model
{
    using System;

    using CodePlex.Diagnostics.Contracts;

    /// <summary>
    /// Represents an entry within the log.
    /// </summary>
    public partial class LogEntryEntity
    {
        #region public LogEntryEntity()
        
        /// <summary>
        /// Initializes a new instance of the <see cref="T:LogEntryEntity"/> class.
        /// </summary>
        public LogEntryEntity()
        {

        } 

        #endregion

        #region public LogEntryEntity(LogEntryDataContract contract, IIdentityDataContract identity)

        /// <summary>
        /// Initializes a new instance of the <see cref="T:LogEntryEntity"/> class.
        /// </summary>
        /// <param name="contract">An instance of the <see cref="T:LogEntryDataContract"/> class to be used to construct an instance of the <see cref="T:LogEntryEntity"/> class.</param>
        /// <param name="identity">An instance of the <see cref="T:IIdentityDataContract"/> class to be used to construct an instance of the <see cref="T:LogEntryEntity"/> class.</param>
        public LogEntryEntity(LogEntryDataContract contract, IIdentityDataContract identity)
        {
            this.AppDomainEntity = new AppDomainEntity(contract.AppDomain);

            this.AssemblyEntity = new AssemblyEntity(contract.Assembly);

            this.LogEntry = contract.Entry;

            this.IIdentityAuthenticationType = identity.AuthenticationType;

            this.IIdentityIsAuthenticated = identity.IsAuthenticated;

            this.IIdentityName = identity.Name;

            this.MachineEntity = new MachineEntity(contract.Machine);

            this.ProcessEntity = new ProcessEntity(contract.Process);

            this.PublicationId = Guid.NewGuid();

            this.ThreadEntity = new ThreadEntity(contract.Thread);
        }

        #endregion
    }
}
